-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stdenv.mkDerivation: overlay style overridable recursive attributes #119942
stdenv.mkDerivation: overlay style overridable recursive attributes #119942
Conversation
a4728f7
to
9c44bf7
Compare
I see how this can be useful in the case of using It is a common use case to use the current package in When thinking this further, what if i override a package and also test another package that depend on it in it's |
If you don't use
|
Also, I would check out the saga of #27319 PR, which had similar goals long before, but ended up being reverted for perf reasons (IIRC). |
f3e4cff
to
f95f7ef
Compare
f95f7ef
to
37f000c
Compare
37f000c
to
0f2c1fa
Compare
I've updated the docs. It now includes this example which I think is particularly nice:
This is quite different and I've checked performance with
master:
overridable:
So the slowdown is only 0.45%, which seems like a fair price to pay for correctness. Memory usage has increased slightly as well. --- master.stats 2021-05-02 23:46:59.409895694 +0200
+++ overridable.stats 2021-05-02 23:47:12.699873034 +0200
@@ -1,27 +1,27 @@
{
- "cpuTime": 1.72167,
+ "cpuTime": 1.70415, # noisy; ignore; see proper stats above
"envs": {
- "number": 565107,
- "elements": 1036066,
- "bytes": 17330240
+ "number": 587547,
+ "elements": 1063062,
+ "bytes": 17905248
},
"list": {
- "elements": 364943,
- "bytes": 2919544,
+ "elements": 373857,
+ "bytes": 2990856,
"concats": 53359
},
"values": {
- "number": 2043552,
- "bytes": 49045248
+ "number": 2058343,
+ "bytes": 49400232
},
"symbols": {
- "number": 92751,
- "bytes": 2812685
+ "number": 92755,
+ "bytes": 2812733
},
"sets": {
- "number": 189351,
- "bytes": 175026936,
- "elements": 7229672
+ "number": 198270,
+ "bytes": 177275760,
+ "elements": 7320400
},
"sizes": {
"Env": 16,
@@ -29,15 +29,15 @@
"Bindings": 8,
"Attr": 24
},
- "nrOpUpdates": 105296,
- "nrOpUpdateValuesCopied": 6123991,
- "nrThunks": 1545207,
- "nrAvoided": 963446,
- "nrLookups": 596064,
- "nrPrimOpCalls": 382588,
- "nrFunctionCalls": 501801,
+ "nrOpUpdates": 109755,
+ "nrOpUpdateValuesCopied": 6205698,
+ "nrThunks": 1559996,
+ "nrAvoided": 989027,
+ "nrLookups": 601181,
+ "nrPrimOpCalls": 387046,
+ "nrFunctionCalls": 517808,
"gc": {
"heapSize": 402915328,
- "totalBytes": 287925024
+ "totalBytes": 292058624
}
} |
This pattern allows for easier overriding of the derivations attributes like described and discussed in NixOS#119942. In this context - adapt the handling of the version and revision handling so overriding it gets reflected in the version string that kodi displays in the UI - make the bundled dependencies available for overriding
This pattern allows for easier overriding of the derivations attributes like described and discussed in NixOS#119942. In this context - adapt the handling of the version and revision handling so overriding it gets reflected in the version string that kodi displays in the UI - make the bundled dependencies available for overriding
This pattern allows for easier overriding of the derivations attributes like described and discussed in NixOS#119942. In this context - adapt the handling of the version and revision handling so overriding it gets reflected in the version string that kodi displays in the UI - make the bundled dependencies available for overriding - make some of the existing compilation flags to be overridable consistently with existing options
Motivation for this change
Allows to get rid of confusing
rec { }
inmkDerivation
calls. Overriding an attribute in this style causes derived attributes to be overridden as expected.Allows
passthru
attributes to reference the outputsFixes passthru.tests is wrong after overrides #119407, the problem where if you use
overrideAttrs
, the tests inpassthru
still use the old package.Should allow cleanup of python and rust packaging functions by using "overlay" layers on a prototype derivation, rather than the current workarounds.
See updated manual for usage explanation.
Update: this problem was also brought up in this discussion: #119731 (review)
Update: "overlay" part minus
public
was also discovered and implemented by lilyball #94198Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)